package cn.com.thingo.shyintelligent.util;

import android.content.Context;

import cn.com.thingo.shyintelligent.widget.WaitDialog;


public class WaitDialogUtils {


    /**
     * 显示加载进度圈
     *
     * @param resId
     * @see
     * @since V1.8.2
     */
    public static WaitDialog showWaitDialog(int resId, Context mContext) {
     WaitDialog  mWaitDlg = new WaitDialog(mContext, android.R.style.Theme_Translucent_NoTitleBar);
        mWaitDlg.setWaitText(mContext.getString(resId));
        mWaitDlg.setCancelable(false);
        mWaitDlg.show();
        return mWaitDlg;
    }

    /**
     * 显示加载进度圈
     *
     * @see
     * @since V1.8.2
     */
    public static WaitDialog showWaitDialog(Context mContext) {
       WaitDialog mWaitDlg = new WaitDialog(mContext, android.R.style.Theme_Translucent_NoTitleBar);
        mWaitDlg.setCancelable(false);
        mWaitDlg.show();
        return mWaitDlg;
    }

    /**
     * 显示加载进度圈
     *
     * @see
     * @since V1.8.2
     */
    public static WaitDialog showCancelableWaitDialog(Context mContext) {
      WaitDialog  mWaitDlg = new WaitDialog(mContext, android.R.style.Theme_Translucent_NoTitleBar);
        mWaitDlg.setCancelable(true);
        mWaitDlg.show();
        return  mWaitDlg;
    }

    /**
     * 判断dialog是否显示
     *
     * @see
     * @since V1.8.2
     */
    public  static  boolean isDialogShowing(WaitDialog mWaitDlg) {
        if (mWaitDlg != null && mWaitDlg.isShowing()) {
            return true;
        } else {
            return false;
        }
    }

    /**
     * dismiss进度圈
     *
     * @see
     * @since V1.8.2
     */
    public static void dismissWaitDialog(WaitDialog mWaitDlg) {
        if (mWaitDlg != null && mWaitDlg.isShowing()) {
            mWaitDlg.dismiss();
        }
    }

}
